import { ref, computed, provide } from 'vue'
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', () => {

  const loginstatus=ref(false)
  const data=ref({})
  function setData(value){
    data.value=value
  }
  function changestatusForTrue(){
    loginstatus.value=true
  }
  function changestatusForFalse(){
    loginstatus.value=false
  }
  
  return { loginstatus,data,setData,changestatusForTrue,changestatusForFalse }
},{
  persist: {
    // 开启持久化
    enabled: true, 
    // 选择存储方式和内容，
    strategies: [
      { storage: sessionStorage, paths: ['loginstatus'] },
    ],
  }
})
